
#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
#include <windows.h>

extern "C" DWORD PALHost_Register  (void* param1=NULL,void* param2=NULL);
extern "C" DWORD PALHost_LaunchApp (LPCTSTR lpCmdLine, LPDWORD lpCode);
extern "C" void  PALHost_Deregister();

int WINAPI WinMain(	HINSTANCE hInstance,
					HINSTANCE hPrevInstance,
					LPTSTR    lpCmdLine,
					int       nCmdShow)
{
	if ( lpCmdLine[0] )
	{
		DWORD hRes = PALHost_Register(NULL, NULL);

#if DEBUG
		TCHAR buf[100];
		swprintf( buf, _T("PALHost_Register: 0x%x\n"), hRes );
		OutputDebugString(buf);
#endif
		
		DWORD exitCode; 
		hRes = PALHost_LaunchApp(lpCmdLine, &exitCode);
#if DEBUG
		swprintf( buf, _T("PALHost_LaunchApp: 0x%x\n"), hRes );
		OutputDebugString(buf);
#endif

		PALHost_Deregister();

		return exitCode;
	}

	return 0;
}
